<%--
  Created by IntelliJ IDEA.
  User: 16061
  Date: 2025/3/21
  Time: 下午3:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

</body>
</html>
<script>
    //通过json描述一个用户对象(id,name,sex)
    //key值类似于对象的属性名,value类似于属性值
    var user={
        id:1,
        name:"wang",
        sex:"男"
    };
    //利用对象名.key获取value
    // alert(user.id+" "+user.name+" "+user.sex)
    //通过json描述一个班级对象(id,classname,users用户集合)
    var classes={
        id:10,
        classname:"1班",
        users:[
            {id:10,name:"wang",sex:"男"},
            {id:11,name:"zhang",sex:"女"},
            {id:12,name:"li",sex:"男"}
        ]
    };
    // for(var i=0;i<classes.users.length;i++){
    //     var u=(classes.users[i])
    //     alert(u.id+" "+u.name+" "+u.sex)
    // }
    //通过json描述一个员工对象(id,name,info(员工信息对象))
    //info(id,sex,sal)
    var emp={
        id:1,
        name:"wang",
        info:{
            id:10,
            sex:"男",
            sal:10000
        }
    };
    alert(emp.id+" "
        +emp.name+" " +
        " "+emp.info.id+
        " "+emp.info.sex+
        " "+emp.info.sal)
</script>